/**
This class is frame rate utilities. Using constant frame rate method
*/

#pragma once

class FrameRate
{
public:
	FrameRate(void);
	~FrameRate(void);

	/**
	 *	default frame rate
	 */
	static const int FRAME_RATE = 60;

	/** 
	*	invoke this method where you want to begin calculating the frame time.
	*/
	void startFrame();
	/** 
	*	invoke this method where you want to end calculating the frame time.
	*/
	void endFrame();

	/**
	 *	lock the frame rate, the function is simply waiting, call after EndFrame()
	 */
	void lockFrame() const;

	/**
	 *	getters
	 */
	int getInnerFPS() const;
	int getOutterFPS() const;
	double getDelta() const;

	static long s_currentFrame;
private:
	double GetTime() const;
private:
	double mSecondPerFrame;
	double mLastFrameTime;
	double mStartFrameTime;
	double mEndFrameTime;
	double mOutterDelta;
	double mDelta;
};
